import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:myflutterproject/routes.dart';
import 'package:myflutterproject/utils/overScrollBehavior.dart';

class BaseWidgetsDemo extends StatefulWidget{
  @override
  State<StatefulWidget> createState() =>BaseWidgetsState();
}

class BaseWidgetsState extends State<BaseWidgetsDemo>{
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('基础组件'),
        centerTitle: true,
      ),
      body: Center(
        child: ScrollConfiguration(
          behavior: OverScrollBehavior(),
          child: ListView(
            children: <Widget>[
              ItemButton('Container', containerDemo),
              ItemButton('Row', rowDemo),
              ItemButton('Column', columndemo),
              ItemButton('Image', imageDemo),
              ItemButton('Text', newText),
              ItemButton('RaisedButton', raisedbuttondemo),
              ItemButton('Scaffold', scaffoldDemo),
              ItemButton('FlutterLogo', flutterlogodemo),
              ItemButton('Placeholder', placeholderdemo),
            ],
          ),

        ),
      ),
    );

  }

}

class ItemButton extends StatelessWidget{
  final String name;
  final String route;

  ItemButton(this.name, this.route);

  @override
  Widget build(BuildContext context) {
    return FlatButton(
        onPressed:()=> Navigator.pushNamed(context, route),
        child: Text(name,style: TextStyle(fontSize: 20,color: Colors.blue),));
  }

}